#include "RequestQueue.h"
#include "ServerThread.h"
#include "ClientThread.h"
#include <process.h>

int main()
{
    RequestQueue* rq = new RequestQueue();    
    Client* c = new Client(rq, "Alice", 6535897L);    
    Server* s = new Server(rq, "Bobby", 3141592L);
    Server* s2 = new Server(rq, "Covic", 2434352L);

    unsigned threadID;
    HANDLE hc = (HANDLE)_beginthreadex(0,0,ClientThread::run,(void*)c,0,&threadID);
    HANDLE hs = (HANDLE)_beginthreadex(0,0,ServerThread::run,(void*)s,0,&threadID);    
    HANDLE hs2 = (HANDLE)_beginthreadex(0,0,ServerThread::run,(void*)s2,0,&threadID);

    WaitForSingleObject(hs2,INFINITE);
    WaitForSingleObject(hs,INFINITE);
    WaitForSingleObject(hc,INFINITE);

    delete c;
    delete s;    
    delete rq;

    return 0;
}